package com.yc.blog.springboot.event.demo1;

import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

/**
 * 异常监听者
 */
@Component
public class Listener4 {

	@Async
	@EventListener
	public void listenerMyEvent1(MyEvent1 event) {
		System.out.println("Listener4 收到事件通知：" + event.getMessage());
		try {
			Thread.sleep(30000);//睡眠30秒，表示某个监听者执行时间过长
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		System.out.println("----Listener4--over");
		//do something
	}

}
